home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / CIncludes / ADSP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  7.5 KB  |  215 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ADSP.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __ADSP__
  13. #define __ADSP__
  14.  
  15. #ifndef __APPLETALK__
  16. #include <AppleTalk.h>
  17. #endif
  18.  
  19.  
  20. enum {
  21.  
  22.  
  23. /* driver control ioResults */
  24.  errRefNum = -1280,                /* bad connection refNum */
  25.  errAborted = -1279,            /* control call was aborted */
  26.  errState = -1278,                /* bad connection state for this operation */
  27.  errOpening = -1277,            /* open connection request failed */
  28.  errAttention = -1276,            /* attention message too long */
  29.  errFwdReset = -1275,            /* read terminated by forward reset */
  30.  errDSPQueueSize = -1274,        /* DSP Read/Write Queue Too small */
  31.  errOpenDenied = -1273,            /* open connection request was denied */
  32.  
  33. /*driver control csCodes*/
  34.  dspInit = 255,                    /* create a new connection end */
  35.  dspRemove = 254,                /* remove a connection end */
  36.  dspOpen = 253,                    /* open a connection */
  37.  dspClose = 252,                /* close a connection */
  38.  dspCLInit = 251,                /* create a connection listener */
  39.  dspCLRemove = 250,                /* remove a connection listener */
  40.  dspCLListen = 249,                /* post a listener request */
  41.  dspCLDeny = 248,                /* deny an open connection request */
  42.  dspStatus = 247,                /* get status of connection end */
  43.  dspRead = 246,                    /* read data from the connection */
  44.  dspWrite = 245,                /* write data on the connection */
  45.  dspAttention = 244                /* send an attention message */
  46. };
  47. enum {
  48.  dspOptions = 243,                /* set connection end options */
  49.  dspReset = 242,                /* forward reset the connection */
  50.  dspNewCID = 241,                /* generate a cid for a connection end */
  51.  
  52. /* connection opening modes */
  53.  ocRequest = 1,                    /* request a connection with remote */
  54.  ocPassive = 2,                    /* wait for a connection request from remote */
  55.  ocAccept = 3,                    /* accept request as delivered by listener */
  56.  ocEstablish = 4,                /* consider connection to be open */
  57.  
  58. /* connection end states */
  59.  sListening = 1,                /* for connection listeners */
  60.  sPassive = 2,                    /* waiting for a connection request from remote */
  61.  sOpening = 3,                    /* requesting a connection with remote */
  62.  sOpen = 4,                        /* connection is open */
  63.  sClosing = 5,                    /* connection is being torn down */
  64.  sClosed = 6,                    /* connection end state is closed */
  65.  
  66. /* client event flags */
  67.  eClosed = 0x80,                /* received connection closed advice */
  68.  eTearDown = 0x40,                /* connection closed due to broken connection */
  69.  eAttention = 0x20,                /* received attention message */
  70.  eFwdReset = 0x10,                /* received forward reset advice */
  71.  
  72. /* miscellaneous constants */
  73.  attnBufSize = 570,                /* size of client attention buffer */
  74.  minDSPQueueSize = 100            /* Minimum size of receive or send Queue */
  75. };
  76.  
  77. /* connection control block */
  78. struct TRCCB {
  79.  unsigned char *ccbLink;        /* link to next ccb */
  80.  unsigned short refNum;            /* user reference number */
  81.  unsigned short state;            /* state of the connection end */
  82.  unsigned char userFlags;        /* flags for unsolicited connection events */
  83.  unsigned char localSocket;        /* socket number of this connection end */
  84.  AddrBlock remoteAddress;        /* internet address of remote end */
  85.  unsigned short attnCode;        /* attention code received */
  86.  unsigned short attnSize;        /* size of received attention data */
  87.  unsigned char *attnPtr;        /* ptr to received attention data */
  88.  unsigned char reserved[220];    /* for adsp internal use */
  89. };
  90.  
  91. typedef struct TRCCB TRCCB;
  92. typedef TRCCB *TPCCB;
  93.  
  94. /* init connection end parameters */
  95. struct TRinitParams {
  96.  TPCCB ccbPtr;                    /* pointer to connection control block */
  97.  ProcPtr userRoutine;            /* client routine to call on event */
  98.  unsigned short sendQSize;        /* size of send queue (0..64K bytes) */
  99.  unsigned char *sendQueue;        /* client passed send queue buffer */
  100.  unsigned short recvQSize;        /* size of receive queue (0..64K bytes) */
  101.  unsigned char *recvQueue;        /* client passed receive queue buffer */
  102.  unsigned char *attnPtr;        /* client passed receive attention buffer */
  103.  unsigned char localSocket;        /* local socket number */
  104. };
  105.  
  106. typedef struct TRinitParams TRinitParams;
  107.  
  108. /* open connection parameters */
  109. struct TRopenParams {
  110.  unsigned short localCID;        /* local connection id */
  111.  unsigned short remoteCID;        /* remote connection id */
  112.  AddrBlock remoteAddress;        /* address of remote end */
  113.  AddrBlock filterAddress;        /* address filter */
  114.  unsigned long sendSeq;            /* local send sequence number */
  115.  unsigned short sendWindow;        /* send window size */
  116.  unsigned long recvSeq;            /* receive sequence number */
  117.  unsigned long attnSendSeq;        /* attention send sequence number */
  118.  unsigned long attnRecvSeq;        /* attention receive sequence number */
  119.  unsigned char ocMode;            /* open connection mode */
  120.  unsigned char ocInterval;        /* open connection request retry interval */
  121.  unsigned char ocMaximum;        /* open connection request retry maximum */
  122. };
  123.  
  124. typedef struct TRopenParams TRopenParams;
  125.  
  126. /* close connection parameters */
  127. struct TRcloseParams {
  128.  unsigned char abort;            /* abort connection immediately if non-zero */
  129. };
  130.  
  131. typedef struct TRcloseParams TRcloseParams;
  132.  
  133. /* client status parameter block */
  134. struct TRstatusParams {
  135.  TPCCB ccbPtr;                    /* pointer to ccb */
  136.  unsigned short sendQPending;    /* pending bytes in send queue */
  137.  unsigned short sendQFree;        /* available buffer space in send queue */
  138.  unsigned short recvQPending;    /* pending bytes in receive queue */
  139.  unsigned short recvQFree;        /* available buffer space in receive queue */
  140. };
  141.  
  142. typedef struct TRstatusParams TRstatusParams;
  143.  
  144. /* read/write parameter block */
  145. struct TRioParams {
  146.  unsigned short reqCount;        /* requested number of bytes */
  147.  unsigned short actCount;        /* actual number of bytes */
  148.  unsigned char *dataPtr;        /* pointer to data buffer */
  149.  unsigned char eom;                /* indicates logical end of message */
  150.  unsigned char flush;            /* send data now */
  151. };
  152.  
  153. typedef struct TRioParams TRioParams;
  154.  
  155. /* attention parameter block */
  156. struct TRattnParams {
  157.  unsigned short attnCode;        /* client attention code */
  158.  unsigned short attnSize;        /* size of attention data */
  159.  unsigned char *attnData;        /* pointer to attention data */
  160.  unsigned char attnInterval;    /* retransmit timer in 10-tick intervals */
  161. };
  162.  
  163. typedef struct TRattnParams TRattnParams;
  164.  
  165. /* client send option parameter block */
  166. struct TRoptionParams {
  167.  unsigned short sendBlocking;    /* quantum for data packets */
  168.  unsigned char sendTimer;        /* send timer in 10-tick intervals */
  169.  unsigned char rtmtTimer;        /* retransmit timer in 10-tick intervals */
  170.  unsigned char badSeqMax;        /* threshold for sending retransmit advice */
  171.  unsigned char useCheckSum;        /* use ddp packet checksum */
  172. };
  173.  
  174. typedef struct TRoptionParams TRoptionParams;
  175.  
  176. /* new cid parameters */
  177. struct TRnewcidParams {
  178.  unsigned short newcid;            /* new connection id returned */
  179. };
  180.  
  181. typedef struct TRnewcidParams TRnewcidParams;
  182.  
  183. /* ADSP CntrlParam ioQElement , driver control call parameter block*/
  184. struct DSPParamBlock {
  185.  struct QElem *qLink;
  186.  short qType;
  187.  short ioTrap;
  188.  Ptr ioCmdAddr;
  189.  ProcPtr ioCompletion;
  190.  OSErr ioResult;
  191.  char *ioNamePtr;
  192.  short ioVRefNum;
  193.  short ioCRefNum;                /* adsp driver refNum */
  194.  short csCode;                    /* adsp driver control code */
  195.  long qStatus;                    /* adsp internal use */
  196.  short ccbRefNum;
  197.  union{
  198.   TRinitParams initParams;        /*dspInit, dspCLInit*/
  199.   TRopenParams openParams;        /*dspOpen, dspCLListen, dspCLDeny*/
  200.   TRcloseParams closeParams;    /*dspClose, dspRemove*/
  201.   TRioParams ioParams;            /*dspRead, dspWrite*/
  202.   TRattnParams attnParams;        /*dspAttention*/
  203.   TRstatusParams statusParams;    /*dspStatus*/
  204.   TRoptionParams optionParams;    /*dspOptions*/
  205.   TRnewcidParams newCIDParams;    /*dspNewCID*/
  206.   } u;
  207. };
  208.  
  209. typedef struct DSPParamBlock DSPParamBlock;
  210. typedef DSPParamBlock *DSPPBPtr;
  211.  
  212.  
  213.  
  214. #endif
  215.